var t = getApp();

Page({
    data: {
        text: "",
        condition_state: "",
        apply_state: 0,
        goods_list: [],
        member_levels: [],
        commission_levels: [],
        team_levels: [],
        check_list: []
    },
    onLoad: function(t) {
        this.getData();
    },
    getData: function() {
        var e = this;
        t._postNetWork({
            url: t.getNetAddresss("plugin.area-merchant.frontend.modules.apply.controllers.page.index"),
            success: function(t) {
                if (1 == t.data.result) {
                    var s = t.data.data, a = s.goods_list, o = s.member_levels, n = s.check_list, l = s.commission_levels, i = s.team_levels, c = s.apply_state, d = s.condition_state;
                    e.setData({
                        condition_state: d,
                        goods_list: a,
                        member_levels: o,
                        check_list: n,
                        commission_levels: l,
                        team_levels: i,
                        apply_state: c
                    }), 0 == c || 1 == c || -1 == c ? e.setData({
                        text: "申请招商员"
                    }) : 2 == c && e.setData({
                        text: "已通过"
                    });
                }
            }
        });
    },
    handle: function() {
        var e = this;
        1 != this.data.apply_state && 2 != this.data.apply_state && t._postNetWork({
            url: t.getNetAddresss("plugin.area-merchant.frontend.modules.apply.controllers.store.index"),
            success: function(t) {
                console.log(t), 1 == t.data.result ? (wx.showToast({
                    icon: "none",
                    title: "已申请，等待后台审批"
                }), e.setData({
                    apply_state: 2
                })) : wx.showToast({
                    title: t.data.data.msg
                });
            }
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});